1. Field of the Invention
The present invention generally relates to data processing and more particularly to the management and use of parameterized queries.
2. Description of the Related Art
Databases are computerized information storage and retrieval systems. A relational database management system is a computer database management system (DBMS) that uses relational techniques for storing and retrieving data. The most prevalent type of database is the relational database, a tabular database in which data is defined so that it can be reorganized and accessed in a number of different ways. A distributed database is one that can be dispersed or replicated among different points in a network. An object-oriented programming database is one that is congruent with the data defined in object classes and subclasses.
Regardless of the particular architecture, in a DBMS, a requesting entity (e.g., an application or the operating system) demands access to a specified database by issuing a database access request. Such requests may include, for instance, simple catalog lookup requests or transactions and combinations of transactions that operate to read, change and add specified records in the database. These requests are made using high-level query languages such as the Structured Query Language (SQL). Illustratively, SQL is used to make interactive queries for getting information from and updating a database such as International Business Machines' (IBM) DB2, Microsoft's SQL Server, and database products from Oracle, Sybase, and Computer Associates. The term “query” denominates a set of commands for retrieving data from a stored database. Queries take the form of a command language that lets programmers and programs select, insert, update, find out the location of data, and so forth.
Queries are constructed of query conditions that serve to filter results returned from the query. Accordingly, a query may be thought of as group of filters put together to sift out only the data in which users are interested. Often, it may be desirable to modify one or more of the query conditions and re-execute the query to determine the effects of the query condition on the results returned. Some high level query languages provide support for parameter markers which allow SQL statements to be generic and reused, allowing for easy modification.
Users can run queries to get a result set, which comprise one or more columns (or fields) of data. Usually, each column in the result set is just a column of text or numbers arranged under a column heading. However, each column in the result set corresponds to a specific field. This field, in the mind of a user, may represent an object which has detailed information associated with it. For instance, suppose that a user has submitted a query against the PATIENTS table and one of the fields included in the query is PAT_ID (short for “Patient ID”). For the user, PAT_ID may represent the patient themselves. The PAT_ID field would be the starting place for any search for detailed information about a particular patient. Currently, there is not an easy way to get detailed information about an object that a field represents.
There are several less than optimal ways a user can get detailed information about the object a field represents. One approach is that the user can remember or write down the identifier of the object they are interested in. They would then create a new query with a condition in that query where the field in question is equal to the identifier. They could then add all of the information they wish to see about the object to the set of result fields. Continuing with the example of finding information about a patient, the user would first remember the patient id, then create a new query with a condition that has the PAT_ID field equal to the appropriate PAT_ID value that they type in. Next, they would find additional fields with interesting data about a particular patient and add them as result fields. Some exemplary fields might be related to the patient's name, address, and title. The above method of retrieving detail data is time consuming and needlessly repetitive.
Another approach is to provide parameterized queries to allow users to drill down into objects contained in the results set. The concept of parameterized queries can be described with reference to the following simple query:                Select*from employeeTable where gender=‘M’The query returns a list of all male employees listed in a table employeeTable. The query may be rewritten as:        Select*from employeeTable where gender=?        
The question mark replacing the ‘M’ represents a parameter marker and instructs the database engine that this specific value (for gender) will be provided later. By making this change, this single query can be used for selecting all the male employees or all the female employees, by setting the parameter marker to ‘M’ or ‘F’, respectively. Thus, a parameterized query is a query in which a parameter marker is included in place of a value. A value may be later substituted for the parameter marker to generate an executable query.
For purposes of getting detailed information about an object, users can utilize parameterized queries to drill down into objects returned in the results set by passing specific values from the result set to the parameterized query and submitting the parameterized query. While use of parameterized queries would be advantageous for users, they would have a difficult time identifying the appropriate parameterized query to use for getting detailed information about a specific object. In other words, users may not be aware of that a parameterized query associated with a specific type of data object even exists. Further, the task of creating and managing parameterized queries can be cumbersome and difficult.
Therefore, there is a need for improved methods of providing users more efficient processes for getting detail data about an object via parameterized queries. There is a further need for a solution that minimizes reliance on administrators, but still provides only those parameterized queries that are contextually relevant to data selected by users.